﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Common.Helper;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition
{
    public partial class Reg : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "会员注册" + WebTitle;

            if (stmd != null)
            {
                if (stmd.IsAsk == 0)
                {
                    imgAsk.Visible = true;
                    imgAsk.Src = "images/reghui.gif";
                    spask.Visible = true;
                    spask.Text = "调查问卷";
                }
                else {
                    imgAsk.Visible = false;
                    spask.Visible = false; 
                
                }
                regXY.Value = stmd.RegAgree;
            }
        }

        protected void btnNext_Click(object sender, EventArgs e)
        {
            UserModel umdl = new UserModel();
            if (Request["login_name"] != null) {
                umdl.UserName = Request["login_name"];
                umdl.Email = Request["login_name"];
            }
            if (Request["login_password"] != null) {
                umdl.PassWord = StringUtils.EncryptPassWord(Request["login_password"], StringUtils.PassFormat.MD5);
            }  

            umdl.CreateTime = DateTime.Now;
            umdl.SiteID = stmd.Id;
            
            //umdl.UserType=
            if (Request["qzlx"] != null) {
                umdl.UserType = Convert.ToInt32(Request["qzlx"]);
            }
            Session["RegUser"] = umdl;
            Response.Redirect("Reg2.aspx");
           
        }
    }
}